package com.ia2014.tp.portal2.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 * Representa a un objeto necesario para la configuracion.
 * @author DiegoAlejandro
 *
 */
@Entity
@Table(name="modulos")
@NamedQuery(name="listModulos", query="SELECT m FROM Modulo m ORDER BY m.id")
public class Modulo implements Serializable{
	private static final long serialVersionUID = 6685862472122661069L;

	@Id
	@Column(name="modulo_id")
	private Long id;
	
	@Column(name="nombre_modulo")
	private String nombreModulo;

	@Column(name="ip_address", columnDefinition="varchar(15)")
	private String ip;
	
	public Long getId() {
		return id;
	}
	
	public void setId(Long id) {
		this.id = id;
	}
	
	public String getNombreModulo() {
		return nombreModulo;
	}
	
	public void setNombreModulo(String nombreModulo) {
		this.nombreModulo = nombreModulo;
	}
	
	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Modulo other = (Modulo) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Modulo [id=" + id + ", nombreModulo=" + nombreModulo
				+ ", tipoModulo=" + "]";
	}
}
